<!--  -->
<template>
	<view class="container">
		<view class="head">
			<u-navbar :is-fixed="false" :border-bottom="false" :is-back="false" title="个人中心"
				:background="{ background: 'transprent' }" title-color="#FFFFFF">
				<view @click="$u.func.route('/pages/system/setting')" slot="right">
					<image src="/static/images/user/setting.png" class="set-icon" mode="widthFix"></image>
				</view>
			</u-navbar>
			<!-- <image src="/static/images/user/bg.png" class="head-bg" /> -->

			<!-- 用户信息 -->
			<view class="user-box">
				<view class="left">
					<image :src="userInfo.avatar" class="avatar" mode=""></image>
					<view class="user-name">{{ userInfo.username }}</view>
					<view class="tag"> 邀请收益 100w</view>
				</view>
				<view @click="$u.func.route('/pages/user/profile')" class="edit-btn">编辑资料</view>
			</view>
			<!-- 操作按钮 -->
			<view class="nav">
				<navigator url="/pages/share/share" hover-class="none" class="nav-item">
					<image src="/static/images/user/n1.png" class="icon" mode=""></image>
					<view class="name">邀请有礼</view>
				</navigator>
				<navigator url="/pages/coin/asset" hover-class="none" class="nav-item">
					<image src="/static/images/user/n2.png" class="icon" mode=""></image>
					<view class="name">我的资产</view>
				</navigator>
				<navigator url="/pages/system/charge" hover-class="none" class="nav-item">
					<image src="/static/images/user/n4.png" class="icon" mode=""></image>
					<view class="name">充值中心</view>
				</navigator>
			</view>
		</view>
		<!-- 功能列表 -->
		<view class="cell-box">
			<u-cell-group :border="false">
				<u-cell-item title="我的资料" bg-color="#101334" @click="$u.func.route('/pages/user/profile')"
					:title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c1.png" class="icon" mode=""></image>
				</u-cell-item>
				<!-- <u-cell-item title="我的积分" bg-color="#101334" :title-style="valueStyle" @click="$u.func.route('/pages/system/integration')">
					<image slot="icon" src="/static/images/user/c2.png" class="icon" mode=""></image>
				</u-cell-item> -->
				<u-cell-item title="API绑定设置" bg-color="#101334" :border-bottom="false" :title-style="valueStyle"
					@click="$u.func.route('/pages/system/keybind')">
					<image slot="icon" src="/static/images/user/c3.png" class="icon" mode=""></image>
				</u-cell-item>
			</u-cell-group>
		</view>
		<view class="cell-box">
			<u-cell-group :border="false">
				<u-cell-item title="分享" bg-color="#101334" @click="$u.func.route('/pages/share/promotionPoster')"
					:title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c4.png" class="icon" mode=""></image>
				</u-cell-item>

				<u-cell-item title="客服中心" bg-color="#101334" :border-bottom="false" @click="showKeFu"
					:title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c7.png" class="icon" mode=""></image>
				</u-cell-item>

				<u-cell-item title="帮助中心" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/set')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>

			</u-cell-group>
		</view>
		<view class="cell-box">
			<u-cell-group :border="false">
				<u-cell-item title="设置" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/system/setting')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>
			</u-cell-group>
			<u-cell-group :border="false">
				<u-cell-item title="测试" bg-color="#101334" :border-bottom="false"
					@click="test()" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>
			</u-cell-group>
		</view>
		<view class="cell-box" :hidden="true">
			<u-cell-group :border="false">

				<u-cell-item title="set" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/set')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""
						style="background-color: #101334;color:#fff"></image>
				</u-cell-item>
			</u-cell-group>
		</view>
		<view class="cell-box" :hidden="true">
			<u-cell-item title="邀请" bg-color="#101334" :border-bottom="false"
				@click="$u.func.route('/pages/test/invite-link')" :title-style="valueStyle">
				<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""
					style="background-color: #101334;color:#fff"></image>
			</u-cell-item>
			<u-cell-item title="lock" bg-color="#101334" :border-bottom="false"
				@click="$u.func.route('/pages/system/gestureLock')" :title-style="valueStyle">
				<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""
					style="background-color: #101334;color:#fff"></image>
			</u-cell-item>
			<u-cell-item title="input" bg-color="#101334" :border-bottom="false"
				@click="$u.func.route('/pages/test/testinput')" :title-style="valueStyle">
				<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""
					style="background-color: #101334;color:#fff"></image>
			</u-cell-item>

		</view>
		<view class="cell-box" :hidden="true">
			<u-cell-group :border="false">
				<u-cell-item title="测试" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/market')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""
						style="background-color: #101334;color:#fff"></image>
				</u-cell-item>
				<u-cell-item title="交易" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/deal')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>
				<u-cell-item title="邀请" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/invite')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>
				<u-cell-item title="客服" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/kefu')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>
				<u-cell-item title="quant" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/quant')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>

				<u-cell-item title="home" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route('/pages/test/home')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>
				<u-cell-item title="news" bg-color="#101334" :border-bottom="false"
					@click="$u.func.route2('/pages/news/index')" :title-style="valueStyle">
					<image slot="icon" src="/static/images/user/c8.png" class="icon" mode=""></image>
				</u-cell-item>
			</u-cell-group>
		</view>

		<!-- 弹窗 -->
		<!-- <u-popup v-model="showKefu" mode="center">
			<view class="kefuPanel">
				<u-image width="100%" height="100%" src="/static/me/kfwx.jpg"></u-image>
			</view>
		</u-popup> -->
		<kefu-popup :showKefu="showKefu" @closePopup="closePopup"></kefu-popup>
		<!-- <u-tabbar :list="tabbarArr" :mid-button="true" bg-color="#101334"></u-tabbar> -->
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from "vuex";
	import kefuPopup from '@/components/kefu-popup/index'
	export default {
		computed: {
			...mapState('tabbar', ['tabbarArr']),
		},
		components:{
			kefuPopup
		},
		data() {
			return {
				userInfo: {
					username: "aqie"
				},
				showKefu: false,
				valueStyle: {
					color: "#f5f5f5"
				}
			};
		},
		onload() {
			let isLogin = uni.getStorageSync('isLogin');
			if (isLogin) {
				console.log('用户登录')
				this.$u.api.userInfo().then(data => {
					console.log('userInfo', data)
					this.userInfo = data.data

				}).catch(err => {
					console.log(err)
					this.$u.func.showToast({
						title: '用户信息获取失败',
					})
				})
			}

		},
		methods: {
			showKeFu() {
				this.showKefu = true
				console.log('showKefu', this.showKefu)
			},
			closePopup(c){
				this.showKefu = c
				console.log('closePopup', this.showKefu)
			},
			testPage() {
				uni.navigateTo({
					url: "/pages/test/cmd-progress",
				});
			},
			test(){
				uni.navigateTo({
					url: "/pages/test/deal",
				});
			}
		}
	};
</script>

<style lang="scss">
	.container {
		background-color: #101334;
		min-height: 100vh;
		overflow: scroll;
		padding-bottom: 160rpx;

	}

	.head {
		position: relative;
		top: 0;
		left: 0;
		z-index: 1;
		min-height: 500rpx;
		overflow: hidden;
		background: #101334;

		.set-icon {
			vertical-align: middle;
			width: 41rpx;
			height: auto;
			margin-right: 35rpx;
		}

		.head-bg {
			position: absolute;
			left: 0px;
			top: 0px;
			z-index: -1;
			width: 750rpx;
			height: 582rpx;
			background: #585b61;
		}
	}

	.user-box {
		display: flex;
		justify-content: space-between;
		padding: 0 20rpx 0 64rpx;
		margin-top: 36rpx;

		.left {
			display: flex;
			flex-direction: column;
			align-items: center;

			.avatar {
				width: 128rpx;
				height: 128rpx;
				background: #ffffff;
				border-radius: 50%;
			}

			.user-name {
				margin-top: 20rpx;
				font-size: 36rpx;
				font-family: Source Han Sans CN;
				font-weight: 500;
				color: #ffffff;
			}

			.tag {
				margin-top: 20rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				padding: 5rpx 16rpx;
				border: 1px solid #f5f5f5;
				border-radius: 7rpx;

				font-size: 19rpx;
				font-family: Source Han Sans CN;
				font-weight: 300;
				color: #ffffff;
			}
		}

		.edit-btn {
			margin-top: 20rpx;
			flex-shrink: 0;
			display: flex;
			justify-content: center;
			align-items: center;

			width: 165rpx;
			height: 54rpx;
			border: 2rpx solid #f5f5f5;
			border-radius: 11rpx;

			font-size: 27rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #ffffff;
		}
	}

	.nav {
		display: flex;
		//border-top: 2rpx solid #7dcdd6;
		margin: 36rpx 38rpx 0;
		padding: 36rpx 0 42rpx;

		.nav-item {
			width: calc(100% / 3);
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: space-between;

			font-size: 25rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #ffffff;

			&:not(:last-of-type) {
				position: relative;

				&::after {
					position: absolute;
					right: 0;
					top: 50%;
					transform: translateY(-50%);
					content: '';
					display: block;
					width: 2rpx;
					background-color: #f5f5f5;
					height: 30rpx;
				}
			}

			.icon {
				width: 48rpx;
				height: 48rpx;
				margin-bottom: 6rpx;
			}
		}
	}

	.cell-box {
		background: #101334;
		color: aliceblue;
		margin: 18rpx;

		.icon {
			width: 32rpx;
			height: 32rpx;
			margin-right: 22rpx;
		}

		>>>.u-cell_title {
			color: aliceblue;
		}
	}
</style>
